<!-- BEGIN PAGE HEADER-->
<?php $this->load->view('partials/breadcrumb.tpl') ?>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
    <div class="col-xs-6 ">
        <!-- BEGIN SAMPLE FORM PORTLET-->
        <div class="portlet box green ">
            <?= edit_form_caption('物流发货') ?>
            <div class="portlet-body form">
                <?= form_open(site_url('storage/shipping/add_post'), Array('class' => 'form-horizontal', 'role' => 'form', 'id' => 'form_edit', 'data-category-id' => $obj->id)) ?>
                <div class="form-body">
                    <input type="hidden" class="form-control" name="record_ids" value="<?= $ids ?>">
                    <input type="hidden" class="form-control" name="operator_id" value="<?= $this->_user->id ?>">
                    <?= edit_form_dropdown('shop_id', array('' => '选择账户组...') + $allShops, set_value('shop_id', $list[0]->shop_id), '选择账户组', "class='select2me' style='width:100%;'") ?>

                    <?= edit_form_input('shipping_number', set_value('shipping_number', $obj->shipping_number), '物流单号','required') ?>
                    <?= edit_form_input('shipping_desc', set_value('shipping_desc', $obj->shipping_desc), '物流方式','required') ?>
                    <?= edit_form_dropdown('location', array('' => '选择发货仓库...') + IOSS_StaticConfig::getShippingWarehouse(), set_value('location',$list[0]->location), '选择发货仓库','disabled') ?>
                    <input type="hidden" name="location" value="<?= $list[0]->location ?>">
                    <?= edit_form_input('cost', set_value('cost', $amount), '成本','readonly') ?>
                    <?= edit_form_input('freight', set_value('freight', $obj->freight), '运费') ?>

                    <?= edit_form_input('boxs', set_value('boxs', $obj->boxs), '打包箱数','required') ?>

                    <div class="form-group">
                        <label class="col-xs-3 control-label">发货时间</label>
                        <div class="col-xs-7">
                            <div class="input-group input-large date-picker input-daterange" data-date=""
                                 data-date-format="yyyy-mm-dd">
                                <input required type="text" class="form-control" name="shipping_time" value="<?= set_value('purchase_time', $obj->purchase_time) ?>" placeholder="发货时间" autoComplete="off">
                            </div>
                        </div>
                    </div>

                    <?=edit_form_radio_list('status', MStorageShipping::getState(), set_value('status', ($thisMethod == 'edit'?$obj->status:'1')), '状态')?>

                    <?= edit_form_textarea('remark', set_value('remark', $obj->remark), '备注信息') ?>
                </div>
                <div class="form-actions">
                    <div class="row">
                        <div class="col-xs-offset-3 col-xs-4">
                            <button type="submit" class="btn green">
                                <span class="md-click-circle md-click-animate"></span>保存
                            </button>
                            <a href="<?= site_url('storage/shipping/deliver') ?>" class="btn default">返回</a>
                        </div>
                    </div>
                </div>
                <?= form_close() ?>
            </div>
        </div>
    </div>
    <div class="col-md-6">
        <!-- BEGIN SAMPLE TABLE PORTLET-->
        <div class="portlet box purple">
            <div class="portlet-title">
                <div class="caption">
                    物流详情
                </div>
            </div>
            <div class="portlet-body">
                <div class="table-scrollable">
                    <table class="table table-striped table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>商品名称</th>
                            <th>商品单价</th>
                            <th>商品数量</th>
                            <th>商品总计</th>
                            <th>采购人</th>
                            <th>责任人</th>
                            <th>出入库方式</th>
                            <th>商品批次</th>
                            <th>所属账户</th>
                            <th>采购时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach ($list as $v) { ?>
                            <tr>
                                <td><?= $v->id ?></td>
                                <td><?= htmlspecialchars($v->product_name) . '(id:' . $v->product_id . ')' ?></td>
                                <td><?= htmlspecialchars($v->price) ?></td>
                                <td><?= htmlspecialchars($v->quantity) ?></td>
                                <td><?= htmlspecialchars($v->amount) ?></td>
                                <td><?= htmlspecialchars($allPurchaser[$v->purchaser_id]) ?></td>
                                <td><?= htmlspecialchars($v->related_person) ?></td>
                                <td <?php if ($v->mark == 7): ?>class="text-center popovers"
                                    data-container="body" data-trigger="hover" data-placement="top"
                                    data-content="<?= $v->order_no ?>"<?php endif; ?>><?= IOSS_StaticConfig::getShippingType($v->type_mark) ?></td>
                                <td><?= htmlspecialchars($v->warehousing) ?></td>
                                <td><?= htmlspecialchars($allShops[$v->shop_id]) ?></td>
                                <td><?= date('Y-m-d', $v->purchase_time) ?></td>
                            </tr>
                        <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- END SAMPLE TABLE PORTLET-->
    </div>
</div>
<link href="<?= image_url('/static/assets/global/plugins/jstree/dist/themes/default/style.min.css') ?>" rel="stylesheet"
      type="text/css"/>

